//
//  REPersonTableViewCell.m
//  录音
//
//  Created by ywy on 2016/12/23.
//  Copyright © 2016年 Wely. All rights reserved.
//

#import "REPersonTableViewCell.h"
#import "RECheckLogin.h"

@implementation REPersonTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.backgroundColor = [UIColor clearColor];
    self.alpha = 0.0;
    self.bigView.layer.masksToBounds = NO;
    //设置阴影的颜色
    self.bigView.layer.shadowColor= RERGBColor(225, 225, 225).CGColor;
    //设置阴影的偏移量，如果为正数，则代表为往右边偏移
    self.bigView.layer.shadowOffset=CGSizeMake(1, 1);
    //设置阴影的透明度(0~1之间，0表示完全透明)
    self.bigView.layer.shadowOpacity=0.5;
    
    
    
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapView:)];
    [self.firstView addGestureRecognizer:tap];
    
    UITapGestureRecognizer * tapTwo = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapView:)];
    [self.twoView addGestureRecognizer:tapTwo];
    
    UITapGestureRecognizer * tapThree = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapView:)];
    [self.threeView addGestureRecognizer:tapThree];
    self.minutesTextField.delegate = self;
    [self.minutesTextField setEnabled:NO];
}


    
-(void)tapView:(UITapGestureRecognizer*)tap
{
    if (_tapClick) {
        _tapClick(tap.view.tag);
    }
}
// 增加
- (IBAction)addClick:(UIButton *)sender {
 
    NSInteger addnumber =   [self.minutesTextField.text integerValue]+[ @"5" integerValue];
    self.minutesTextField.text = [NSString stringWithFormat:@"%ld分钟",(long)addnumber];
    
    if ([self.changeDelegate respondsToSelector:@selector(cheneMinius:)]) {
        [self.changeDelegate cheneMinius: [RECheckLogin segmentationString:@"分" andAllStr:self.minutesTextField.text]];
    }
    
}
// 减少
- (IBAction)minus:(UIButton *)sender {
    
  NSString * str =   [RECheckLogin segmentationString:@"分" andAllStr:self.minutesTextField.text];
    if ([str integerValue] > 0) {
        NSInteger addnumber =   [str integerValue]-5;
        self.minutesTextField.text = [NSString stringWithFormat:@"%ld分钟",(long)addnumber];
    }
    if ([self.changeDelegate respondsToSelector:@selector(cheneMinius:)]) {
        [self.changeDelegate cheneMinius: [RECheckLogin segmentationString:@"分" andAllStr:self.minutesTextField.text]];
    }
    
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}




- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
